<template>
  <div>
    <component :is="ItemMap[item.type]" v-for="(item, i) in reportConfigs" :reportConfig="item" :reportData="reportData" :key="i" />
  </div>
</template>

<script lang="ts" setup>
  import { ReportData, ReportConfig } from '@/pages/scale/utils/scale.type';
  import { PropType, toRefs } from 'vue';
  import { ItemMap } from './report-module/index';

  const props = defineProps({
    reportData: {
      type: Object as PropType<ReportData>,
      default: () => ({
        companyInfo: {},
        userInfo: {},
        record: [],
        demensions: [],
      }),
    },
    reportConfigs: {
      type: Array as PropType<ReportConfig[]>,
      default: () => [],
    },
  });

  const { reportData, reportConfigs } = toRefs(props);

  console.log(reportData);
  console.log(reportConfigs);
</script>

<style></style>
